package com.lb.uts.quartz;

import com.lb.uts.entity.ScheduleJob;
import com.lb.uts.service.policy.AbstractJobExecute;
import com.lb.uts.service.policy.DefaultJobExecute;
import com.lb.uts.service.policy.IJobExecute;
import com.lb.uts.util.SpringContextUtil;
import org.quartz.JobExecutionContext;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;

/**
 * 远程调用Job
 * 这里写死{@link DefaultJobExecute}，后期如果需要执行其他的执行方式
 * 可以实现{@link IJobExecute}或者继承{@link AbstractJobExecute}
 *
 * @author liangb
 */
@Service
public class RscJob extends BaseQuartzJob {

    protected void run(ApplicationContext springContext, ScheduleJob job, JobExecutionContext jobContext) {
        //得到执行，
        IJobExecute jobExecute = (IJobExecute) SpringContextUtil.getBean("defaultJobExecute", IJobExecute.class);
        jobExecute.executeJob(job);
    }

}
